<?php

declare (strict_types=1);

namespace app\checkin\controller;

use think\admin\helper\QueryHelper;

/**
 * 测试控制器
 * @class Test
 * @package app\checkin\controller
 */
class Test extends Base
{
    /**
     * 测试页面
     * @auth true
     * @menu true
     */
    public function index()
    {
        $this->title = '测试页面';
        
        // 检查设备模型是否可以正常使用
        try {
            $devices = \app\checkin\model\Device::mk()->limit(5)->select()->toArray();
            $this->assign('devices', $devices);
            $this->assign('deviceCount', count($devices));
        } catch (\Throwable $e) {
            $this->assign('error', $e->getMessage());
            $this->assign('devices', []);
            $this->assign('deviceCount', 0);
        }
        
        $this->fetch();
    }
}
